<template>
	<view class="ikz-school">
		<ikz-loading :css-data="loading_css"></ikz-loading>
		<ikz-topbg></ikz-topbg>
		<!-- type == 1-->
		<block v-if="form_data.type == 1">
			<!-- 	<view class="ikz-form-input-box">
				<image class="ikz-form-input-img" src="/static/campus/takeaddr.png"></image>
				<input v-model="form_data.start" class="ikz-form-input" placeholder="取货地点(必填)" />
			</view> -->
			<!-- <view class="ikz-form-input-box ikz-afters" @click="goaddress('1')">
				<image class="ikz-form-input-img" src="/static/campus/takeaddr.png"></image>
				<view v-if="!address_Takedelivery">选择取货地点(必选)</view>
				<view class="ikz-form-address" v-else>
					{{address_Takedelivery.name}}-{{address_Takedelivery.mobile}}
					<view class="ikz-form-address-detail">
						{{address_Takedelivery.group_name}}-{{address_Takedelivery.detail}}
					</view>
				</view>
			</view> -->
			<view class="ikz-form-input-box ikz-afters" @click="goaddress('取货')">
				<image class="ikz-form-input-img" src="/static/campus/takeaddr.png"></image>
				<view v-if="!address_Takedelivery">选择取货地址(必选)</view>
				<view class="ikz-form-address" v-else>
					{{ address_Takedelivery.name }}-{{ address_Takedelivery.mobile }}
					<view class="ikz-form-address-detail">
						{{ address_Takedelivery.group_name }}-{{ address_Takedelivery.detail }}
					</view>
				</view>
			</view>
			<view class="ikz-form-input-box ikz-afters">
				<image class="ikz-form-input-img" src="/static/campus/time.png"></image>
				<view style="width: 80%;">
					<ikz-datetime @returnTime="returnTime"></ikz-datetime>
				</view>
			</view>
			<view class="ikz-form-price-box">
				<view class="ikz-form-price-title">
					跑腿费
				</view>
				<view class="price" style="color: #999;">
					<input type="number" v-model="rent" :placeholder='`请根据实际距离输入价格`'>元
				</view>
			</view>
			<view class="tips">
				*请根据距离远近输入价格，最低{{ rent1 }}元。
			</view>
			<!-- 其他信息 -->
			<view class="ikz-tips">
				<view class="ikz-tips-title">
					收货地址（必填）
				</view>
				<view class="ikz-tips-box">
					<textarea @blur="checkPrice" v-model="form_data.information" class="ikz-tips-text"
						placeholder="请输入收货地址 ,帮送物品数量,大小规格等 （此信息仅接单员可见）"></textarea>
				</view>
			</view>
			<!-- <view class="ikz-take">
       <ikz-updata></ikz-updata> 
      </view> -->
			<!-- 	<view class="ikz-form-price-box">
				<view class="ikz-form-price-title">
					跑腿费
				</view>
				<input @input="check" @blur="checkPrice" v-model="form_data.price" type="digit"
					class="ikz-form-price-input" style="width: 75%;" :placeholder="'请输入跑腿费最低'+min_price+'元'" />
			</view> -->
		</block>

		<!-- type == 1-->
		<!-- type == 2 -->
		<block v-if="form_data.type == 2">
			<!-- <view class="ikz-form-input-box ikz-afters" @click="getExpress()">
				<image class="ikz-form-input-img" src="/static/campus/takeaddr.png"></image>
				<view class="ikz-form-input">
					{{ point_info.title||'取货地点(必选)' }}
				</view>
			</view> -->
			<view class="ikz-form-input-box ikz-afters" @click="goaddress('收货')">
				<image class="ikz-form-input-img" src="/static/campus/shou.png"></image>
				<view v-if="!address_Takedelivery">选择收货地点(必选)</view>
				<view class="ikz-form-address" v-else>
					{{ address_Takedelivery.name }}-{{ address_Takedelivery.mobile }}
					<view class="ikz-form-address-detail">
						{{ address_Takedelivery.group_name }}-{{ address_Takedelivery.detail }}
					</view>
				</view>
			</view>
			<!-- <view class="ikz-form-input-box ikz-afters" @click="goaddress">
				<image class="ikz-form-input-img" src="/static/campus/shou.png"></image>
				<view v-if="!address_default">选择收货地点(必选)</view>
				<view class="ikz-form-address" v-else>
					{{address_default.name}}-{{address_default.mobile}}
					<view class="ikz-form-address-detail">
						{{address_default.group_name}}-{{address_default.detail}}
					</view>
				</view>
			</view> -->
			<view class="ikz-form-input-box ikz-afters">
				<image class="ikz-form-input-img" src="/static/campus/time.png"></image>
				<view style="width: 80%;">
					<ikz-datetime @returnTime="returnTime"></ikz-datetime>
				</view>
			</view>
			<view class="ikz-take" v-for="(item, index) in express_box" :key="index">
				<image class="ikz-take-img" src="/static/campus/box.png"></image>
				<view class="ikz-take-center">
					<view class="ikz-take-title">
						{{ item.type }}：￥{{ item.price }}
					</view>
					<view class="ikz-take-tips">
						{{ item.desc }}
					</view>
				</view>
				<view class="ikz-take-right">
					<view style="width: 50rpx;height: 50rpx;">
						<image v-if="item.number" class="ikz-take-option" src="/static/campus/reduce.png"
							@click="reduceExpress(index)"></image>
					</view>
					<view class="ikz-take-num">{{ item.number || '' }}</view>
					<image class="ikz-take-option" src="/static/campus/add.png" @click="addExpress(index)"></image>
				</view>
			</view>
			<!-- 	<view class="ikz-form-price-box" v-if="expressdelivery">
				<view class="ikz-form-price-title">
					运费
				</view>
				<view class="price" style="color: #FFDC28;">
					{{expressdelivery}}元
				</view>
			</view> -->
			<view class="ikz-tips">
				<view class="ikz-tips-title">
					取货地址（必填）
				</view>
				<view class="ikz-tips-box">
					<textarea class="ikz-tips-text" v-model="form_data.information"
						placeholder="请输入取货地址和帮取的物品，快递码，团购码（此信息仅接单员可见）"></textarea>
				</view>
			</view>
		</block>

		<!-- type == 2 -->

		<!-- type == 3 -->
		<block v-if="form_data.type == 11">
			<view class="ikz-form-input-box ikz-afters">
				<image class="ikz-form-input-img" src="/static/campus/game.png"></image>
				<picker class="ikz-form-input" @change="gamePickerChange" :value="game_name_index"
					:range="game_name_data" range-key="name">
					<view>{{ game_name_data[game_name_index].name }}</view>
				</picker>
			</view>
			<view class="ikz-form-input-box ikz-afters">
				<image class="ikz-form-input-img" src="/static/campus/time.png"></image>
				<picker class="ikz-form-input" @change="gameTimePickerChange" :value="game_time_index"
					:range="game_time_data" range-key="name">
					<view>{{ game_time_data[game_time_index].name }}</view>
				</picker>
			</view>
			<!-- 其他信息 -->
			<view class="ikz-tips">
				<view class="ikz-tips-title">
					游戏信息
				</view>
				<view class="ikz-tips-box">
					<textarea v-model="form_data.information" class="ikz-tips-text" placeholder="请输入游戏信息"></textarea>
				</view>
			</view>
			<!-- <view class="ikz-take">
       <ikz-updata></ikz-updata> 
      </view> -->
			<view class="ikz-form-price-box">
				<view class="ikz-form-price-title">
					游戏ID
				</view>
				<input v-model="form_data.game_id" class="ikz-form-price-input" style="width: 75%;"
					placeholder="填写游戏ID或游戏账号" />
			</view>
			<view class="ikz-form-price-box">
				<view class="ikz-form-price-title">
					接单限制
				</view>
				<picker class="ikz-form-price-input" style="width: 75%;" @change="gameGenderPickerChange"
					:value="game_gender_index" :range="game_gender">
					<view>{{ game_gender[game_gender_index] }}</view>
				</picker>
			</view>
			<view class="ikz-form-price-box">
				<view class="ikz-form-price-title">
					陪玩费
				</view>
				<input @input="check" @blur="checkPrice" v-model="form_data.price" type="digit"
					class="ikz-form-price-input" style="width: 75%;" :placeholder="'请输入陪玩费最低' + min_price + '元'" />
			</view>
		</block>
		<!-- type == 3 -->
		<!-- type == 4-->
		<block v-if="form_data.type == 3">

			<view class="ikz-form-input-box ikz-afters" @click="goaddress('收货')">
				<image class="ikz-form-input-img" src="/static/campus/shou.png"></image>
				<view v-if="!address_default">收货地址(必选)</view>
				<view class="ikz-form-address" v-else>
					{{ address_default.name }}-{{ address_default.mobile }}
					<view class="ikz-form-address-detail">
						{{ address_default.group_name }}-{{ address_default.detail }}
					</view>
				</view>
			</view>
			<!-- <view class="ikz-form-input-box ikz-afters">
				<image class="ikz-form-input-img" src="/static/campus/ztime.png"></image>
				<picker class="ikz-form-input" @change="leasePickerChange" :value="lease_index" :range="lease_time">
					<view>{{lease_time[lease_index]}}</view>
				</picker>
			</view> -->
			<view class="ikz-form-input-box ikz-afters">
				<image class="ikz-form-input-img" src="/static/campus/gettime.png"></image>
				<!-- <picker mode="time" @change="hopeArrivePickerChange" :value="form_data.hope_arrive" start="00:00"
					end="24:59" class="ikz-form-input">
					<view>预计{{form_data.hope_arrive}}交货</view>
				</picker> -->
				<ikz-datetime :multiArray="multiArray" @returnTime="returnTime"></ikz-datetime>
			</view>
			<!-- 其他信息 -->
			<view class="ikz-tips">
				<view class="ikz-tips-title">
					帮买需求（必填）
				</view>
				<view class="ikz-tips-box">
					<textarea v-model="form_data.information" @blur="checkPrice" class="ikz-tips-text"
						placeholder="请输入商品名称,数量,地址 （此信息仅接单员可见）"></textarea>
				</view>
			</view>
			<!-- <view class="ikz-take">
       <ikz-updata></ikz-updata>
      </view> -->
			<!-- <view class="ikz-form-price-box">
				<view class="ikz-form-price-title"> 
					商品费
				</view>
				<input @input="check" @blur="checkPrice" v-model="form_data.price" type="digit"
					class="ikz-form-price-input" style="width: 75%;" :placeholder="'请输入物品实际价值最低'+min_price+'元'" />
			</view> -->

			<view class="ikz-form-price-box">
				<!-- <view class="ikz-form-price-title">
					运费
				</view>
				<view class="price" style="color: #FFDC28;">
					{{rent}}元
				</view> -->
				<view class="ikz-form-price-title">
					跑腿费
				</view>
				<view class="price" style="color: #999;">
					<input type="number" v-model="rent" :placeholder='`请根据实际距离输入价格`'>元
				</view>
			</view>
			<view class="tips">
				*请根据距离远近输入价格，最低{{ rent1 }}元。
			</view>
		</block>

		<!-- type == 5-->
		<block v-if="form_data.type == 5">
			<view class="ikz-form-input-box">
				<image class="ikz-form-input-img" src="/static/campus/down.png"></image>
				<input v-model="form_data.down_url" class="ikz-form-input" placeholder="下载链接(必填)" />
			</view>
			<view class="ikz-form-input-box">
				<image class="ikz-form-input-img" src="/static/campus/email.png"></image>
				<input v-model="form_data.receive_email" class="ikz-form-input" placeholder="收货邮箱(必填)" />
			</view>
			<view class="ikz-form-price-box">
				<view class="ikz-form-price-title">
					下载费
				</view>
				<input @input="check" @blur="checkPrice" v-model="form_data.price" type="digit"
					class="ikz-form-price-input" style="width: 75%;" :placeholder="'请输入下载费最低' + min_price + '元'" />
			</view>
			<view class="ikz-tips">
				<view class="ikz-tips-title">
					下载说明
				</view>
				<view class="ikz-tips-box" style="height: auto;">
					<rich-text :nodes="file_info"></rich-text>
				</view>
			</view>
		</block>
		<!-- type == 5-->

		<!-- type == 6-->
		<block v-if="form_data.type == 6">
			<view class="ikz-form-input-box ikz-afters" @click="goaddress('帮办')">
				<image class="ikz-form-input-img" src="/static/campus/bang.png"></image>
				<view v-if="!address_default.name">选择帮办地点(必选)</view>
				<view v-else class="ikz-form-address">
					{{ address_default.name }}-{{ address_default.mobile }}
					<view class="ikz-form-address-detail">
						{{ address_default.group_name }}-{{ address_default.detail }}
					</view>
				</view>
			</view>
			<!-- 其他信息 -->
			<view class="ikz-tips">
				<view class="ikz-tips-title">
					请输入帮助内容（必填）
				</view>
				<view class="ikz-tips-box">
					<textarea v-model="form_data.information" class="ikz-tips-text" placeholder="请输入要帮助的内容"></textarea>
				</view>
			</view>
			<!-- <view class="ikz-form-price-box">
				<view class="ikz-form-price-title">
					帮助费
				</view>
				<input @input="check" @blur="checkPrice" v-model="form_data.price" type="digit"
					class="ikz-form-price-input" style="width: 75%;" :placeholder="'请输入帮助费最低'+min_price+'元'" />
			</view> -->
		</block>
		<!-- type == 6-->

		<view class="ikz-tips">
			<view class="ikz-tips-title">
				备注信息
			</view>
			<view class="ikz-tips-box">
				<textarea v-model="form_data.remarks" class="ikz-tips-text" placeholder="请输入备注信息"></textarea>
			</view>
		</view>
		<view class="ikz-take">
			<ikz-updata :showData="{
				title: form_data.type == 2 ? '取件码，团购码，核销码' : form_data.type == 3 ? '附加照片' : form_data.type == 1 ? '附加照片' : '备注信息'
			}" @returnFiles="returnFiles"></ikz-updata>
		</view>
		<view style="height:230rpx">
		</view>
		<view class="ikz-bottom">
			<view class="ikz-bottom-box">
				<view class="ikz-bottom-price">
					<text v-if="form_data.type != 6">￥{{ form_data.total_fee || 0 }}</text>
				</view>
				<view class="ikz-bottom-btn" @click="setUp">
					立即提交
				</view>
			</view>
		</view>

	</view>
</template>

<script>
import ikzLoading from '@/pages/Component/Public/Loading/loading.vue';
import ikzTopbg from '@/pages/Component/Public/Topbg/public/topbg/topbg.vue';
import ikzUpdata from '@/pages/Component/Public/Updata/public/updata/updata.vue';
import ikzDatetime from '@/pages/Component/Public/Pickertime/public/datetime/index.vue';
var app = getApp();
import ikz from '@/pages/Common/tools.js';
export default {
	components: {
		ikzLoading,
		ikzTopbg,
		ikzUpdata,
		ikzDatetime
	},
	data() {
		return {

			address_default: '',
			address_Takedelivery: "",
			loading_css: {
				display: 'flex',
			},
			form_data: {
				type: 1,
				game_platform_name: '', //平台名称
				game_platform: '', //游戏平台
				game_time: '1小时', //游戏时间
				game_id: '', //游戏ID
				receive_limit: '不限性别', //游戏接单限制
				lease_duration: '1小时归还', //租借时长
				down_url: '', //下载链接
				receive_email: '', //收件邮箱
				start: '',
				destination: '',
				hope_arrive: '',
				information: '',
				price: '',
				remarks: '',
				reward: '',
				total_fee: 0,
				annex_information_images: [],
				express_temp: []
			},
			point_info: '',
			express_box: [],
			files: [],
			game_name_data: [], //游戏陪玩 
			game_name_index: 0,
			game_time_data: [{
				id: 1,
				name: '1小时'
			},
			{
				id: 2,
				name: '2小时'
			},
			{
				id: 3,
				name: '3小时'
			},
			{
				id: 4,
				name: '4小时'
			},
			], //陪玩时间
			game_time_index: 0,
			game_gender: ['不限性别', '仅限男生', '仅限女生'],
			game_gender_index: 0,
			lease_time: ['1小时归还', '2小时归还', '3小时归还', '4小时归还'], //租借时长
			lease_index: 0,
			lease_return_time: '09:00', //租借时长
			up_status: 2,
			file_info: '',
			min_price: app.globalData.min_price,
			// 4 租借服务运费
			rent: '',
			rent1: '',
			// 1 校园跑腿运费
			campuserrands: '',
			// 2 快递代取运费
			expressdelivery: '',


		}
	},
	onLoad(options) {
		if (!options) {
			return
		}
		this.queryFreight()
		this.form_data.type = options.type;
		if (this.form_data.type == 1) {
			this.loading_css.display = 'none';
			uni.setNavigationBarTitle({
				title: '帮送'
			});
		} else if (this.form_data.type == 2) {
			this.expressBox((res) => {
				this.loading_css.display = 'none';
			});
			uni.setNavigationBarTitle({
				title: '帮取'
			});
		}
		// else if (this.form_data.type == 3) {
		// 	this.ganmeList((res) => {
		// 		this.loading_css.display = 'none';
		// 	});
		// 	uni.setNavigationBarTitle({
		// 		title: '游戏陪玩'
		// 	});
		// } else
		if (this.form_data.type == 3) {
			this.form_data.hope_arrive = '09:00';
			this.loading_css.display = 'none';
			uni.setNavigationBarTitle({
				title: '帮买'
			});
		} else if (this.form_data.type == 5) {
			this.loading_css.display = 'none';
			uni.setNavigationBarTitle({
				title: '文档下载'
			});
			this.fileInfo();
		} else if (this.form_data.type == 6) {
			this.loading_css.display = 'none';
			uni.setNavigationBarTitle({
				title: '帮办'
			});
		}
	},
	onShow() {
		this.address_Takedelivery = app.globalData.user_address.address_default;
		this.address_default = app.globalData.user_address.address_default;
		this.form_data.destination = this.address_default.id;
		if (this.form_data.type == 2) {
			this.point_info = app.globalData.point_info || '';
			this.form_data.start = app.globalData.point_info.id || '';
		}
		this.$forceUpdate();
		
	},
	watch: {
		rent: {
			handler(newVal) {
				if (this.form_data.type == 1) {
					this.form_data.total_fee = Number(newVal)
					this.form_data.transportation_expenses = Number(newVal).toFixed(2)
				} else if (this.form_data.type == 3) {
					this.form_data.total_fee = Number(newVal)
					this.form_data.transportation_expenses = Number(newVal).toFixed(2)
				}
			},
			immediate: true
		}
	},
	methods: {
		// 显示
		showData() {

		},
		// 查询运费
		queryFreight() {
			var path = '/xyb/supermarket/Index/queryFreight';
			var data = {}
			ikz.post(path, data, res => {
				if (res.data.status == 200) {
					this.supermarket = res.data.data.supermarket
					this.rent = res.data.data.rent
					this.rent1 = res.data.data.rent
					// 校园跑腿运费
					this.campuserrands = res.data.data.campuserrands
					this.campuserrands1 = res.data.data.campuserrands
					// 快递代取运费
					this.expressdelivery = res.data.data.expressdelivery
				}
			})
		},
		fileInfo() {
			var path = '/xyb/same/document_download_instructions';
			var data = {}
			ikz.post(path, data, (res) => {
				if (res.data.code) {
					this.file_info = res.data.data.value;
				} else {
					uni.showModal({
						title: '提示',
						content: res.data.msg,
						showCancel: false,
						success: function (res) { }
					});
				}
			});
		},
		setUsp() {

		},
		/* type == 4*/
		leasePickerChange(e) {
			this.lease_index = e.detail.value;
			this.form_data.lease_duration = this.lease_time[this.lease_index];
		},
		hopeArrivePickerChange(e) {
			this.form_data.hope_arrive = e.detail.value;
		},
		/* type == 4*/
		/* type == 3*/
		gameGenderPickerChange(e) {
			this.game_gender_index = e.detail.value;
			this.receive_limit = this.game_gender[this.game_gender_index];
		},
		gamePickerChange(e) {
			this.game_name_index = e.detail.value;
			this.form_data.game_platform = this.game_name_data[this.game_name_index].id;
			this.form_data.game_platform_name = this.game_name_data[this.game_name_index].name;
		},
		gameTimePickerChange(e) {
			this.game_time_index = e.detail.value;
			this.form_data.game_time = this.game_time_data[this.game_time_index].name;
		},
		ganmeList(fn) {
			var path = '/xyb/agent_games/index';
			var data = {}
			ikz.post(path, data, (res) => {
				if (res.data.code) {
					this.game_name_data = res.data.data;
					this.form_data.game_platform = this.game_name_data[0].id;
					this.form_data.game_platform_name = this.game_name_data[0].name;
				} else {
					uni.showModal({
						title: '提示',
						content: res.data.msg,
						showCancel: false,
						success: function (res) { }
					});
				}
				fn();
			});
		},
		/* type==2*/
		//快递点地址
		getExpress() {
			uni.navigateTo({
				url: '/pages/Component/Module/Campus/Program/Express/point/index'
			})
		},
		//增加包裹
		addExpress(index) {
			this.express_box[index].number++;
			this.form_data.total_fee = (parseFloat(this.express_box[index].price) + parseFloat(this.form_data
				.total_fee)).toFixed(2);
		},
		//减少包裹
		reduceExpress(index) {
			this.express_box[index].number--;
			this.form_data.total_fee = (parseFloat(this.form_data.total_fee) - parseFloat(this.express_box[index]
				.price)).toFixed(2)
		},
		//请求包裹数据 
		expressBox(fn) {
			var path = '/xyb/same/express_config';
			var data = {}
			ikz.post(path, data, (res) => {
				if (res.data.code) {
					this.express_box = res.data.data.express_config;
					for (var i = 0; i < this.express_box.length; i++) {
						this.express_box[i].number = 0;
					}
				} else {
					uni.showModal({
						title: '提示',
						content: res.data.msg,
						showCancel: false,
						success: function (res) { }
					});
				}
				fn();
			});
		},
		/* type == 2*/
		//返回图片数据 
		returnFiles(e) {
			this.files = e;
			console.log(e);
		},
		//提交数据
		setUp() {
			if (!uni.getStorageSync('local_user_session')) {
				uni.navigateTo({
					url: "/pages/login/index"
				})
				return
			}
			// if (this.form_data.type == 3) {
			// 	this.gameUp();
			// } else
			this.up_status = 3;
			if (this.form_data.type == 1) {
				// if (this.address_default) {
				// 	wx.showToast({
				// 		title: '请填选择收货地址',
				// 		icon: 'none', 	
				// 		duration: 2000
				// 	})
				// 	return	
				// }
				if(Number(this.rent) < Number(this.rent1)){
					 	wx.showToast({
						title: `跑腿费不得低于${this.rent1}元`,
						icon: 'none', 	
						duration: 2000
					})
					return
				}
				this.runerrandsUp();
			} else if (this.form_data.type == 2) {
				if (!this.address_default) {
					wx.showToast({
						title: '请填选择收货地址',
						icon: 'none',
						duration: 2000
					})
					return
				}
				this.expressUp();
			} else if (this.form_data.type == 3) {
				if(Number(this.rent) < Number(this.rent1)){
					 	wx.showToast({
						title: `跑腿费不得低于${this.rent1}元`,
						icon: 'none', 	
						duration: 2000
					})
					return
				}
				if (!this.address_default) {
					wx.showToast({
						title: '请填选择收货地址',
						icon: 'none',
						duration: 2000
					})
					return
				}
				this.leaseUp();
			} else if (this.form_data.type == 5) {
				this.fileUp();
			} else if (this.form_data.type == 6) {
				if (!this.address_default) {
					wx.showToast({
						title: '请填选择收货地址',
						icon: 'none',
						duration: 2000
					})
					return
				}
				this.otherUp();
			}

		},
		otherUp() {
			uni.showLoading({
				title: '加载中'
			})
			// if (this.form_data.price == '') {
			// 	wx.showToast({
			// 		title: '请填写帮助费',
			// 		icon: 'none',
			// 		duration: 2000
			// 	})
			// 	return
			// }
			// if (parseFloat(this.form_data.price) < parseFloat(app.globalData.min_price)) {
			// 	wx.showToast({
			// 		title: '帮助费最低为' + app.globalData.min_price + '元',
			// 		icon: 'error',
			// 		duration: 2000
			// 	})
			// 	return
			// }
			// if (this.form_data.price >= 10000) {
			// 	wx.showToast({
			// 		title: '帮助费小于1万元',
			// 		icon: 'error',
			// 		duration: 2000
			// 	})
			// 	return
			// }
			if (this.form_data.destination == '') {
				wx.showToast({
					title: '请选择收货地点',
					icon: 'error',
					duration: 2000
				})
				return
			}
			if (this.form_data.information == '') {
				wx.showToast({
					title: '请输入帮助内容',
					icon: 'error',
					duration: 2000
				})
				return
			}
			this.goOrderIndex();
		},
		fileUp() {
			uni.showLoading({
				title: '加载中'
			})
			if (this.form_data.price == '') {
				wx.showToast({
					title: '请填写下载费',
					icon: 'none',
					duration: 2000
				})
				return
			}
			if (parseFloat(this.form_data.price) < parseFloat(app.globalData.min_price)) {
				wx.showToast({
					title: '下载费最低为' + app.globalData.min_price + '元',
					icon: 'error',
					duration: 2000
				})
				return
			}
			if (this.form_data.down_url == '') {
				wx.showToast({
					title: '请输入下载链接',
					icon: 'error',
					duration: 2000
				})
				return
			}
			if (this.form_data.receive_email == '') {
				wx.showToast({
					title: '请输入收件邮箱',
					icon: 'error',
					duration: 2000
				})
				return
			}
			this.goOrderIndex();
		},
		leaseUp() {
			uni.showLoading({
				title: '加载中'
			})
			// if (this.form_data.price == '') {
			// 	wx.showToast({
			// 		title: '请填写帮买费',
			// 		icon: 'none',
			// 		duration: 2000
			// 	})
			// 	return
			// }
			if (parseFloat(this.form_data.price) < parseFloat(app.globalData.min_price)) {
				wx.showToast({
					title: '帮买费最低为' + app.globalData.min_price + '元',
					icon: 'error',
					duration: 2000
				})
				return
			}
			if (this.form_data.price >= 10000) {
				wx.showToast({
					title: '帮买费小于1万元',
					icon: 'error',
					duration: 2000
				})
				return
			}
			if (this.form_data.destination == '') {
				wx.showToast({
					title: '请选择收货地点',
					icon: 'error',
					duration: 2000
				})
				return
			}
			if (this.form_data.information == '') {
				wx.showToast({
					title: '请输入帮买费物品需求',
					icon: 'error',
					duration: 2000
				})
				return
			}
			this.goOrderIndex();
		},
		//游戏陪玩
		gameUp() {
			uni.showLoading({
				title: '加载中'
			})
			if (this.form_data.game_id == '') {
				wx.showToast({
					title: '请填写游戏ID或游戏账号',
					icon: 'none',
					duration: 2000
				})
				return
			}
			if (this.form_data.price == '') {
				wx.showToast({
					title: '请填写陪玩费',
					icon: 'none',
					duration: 2000
				})
				return
			}
			if (parseFloat(this.form_data.price) < parseFloat(app.globalData.min_price)) {
				wx.showToast({
					title: '陪玩费最低为' + app.globalData.min_price + '元',
					icon: 'error',
					duration: 2000
				})
				return
			}
			if (this.form_data.price >= 10000) {
				wx.showToast({
					title: '陪玩费小于1万元',
					icon: 'error',
					duration: 2000
				})
				return
			}
			if (this.form_data.information == '') {
				wx.showToast({
					title: '请输入游戏信息',
					icon: 'error',
					duration: 2000
				})
				return
			}
			this.goOrderIndex();
		},
		//快递
		expressUp() {
			uni.showLoading({
				title: '加载中'
			})

			//判断填写数据是否正确
			if (this.address_Takedelivery == '') {
				wx.showToast({
					title: '请输入取货地点',
					icon: 'error',
					duration: 2000
				})
				return
			}
			if (this.address_default == '') {
				wx.showToast({
					title: '请选择收货地点',
					icon: 'error',
					duration: 2000
				})
				return
			}
			if (this.form_data.hope_arrive == '') {
				wx.showToast({
					title: '请选择送达时间',
					icon: 'error',
					duration: 2000
				})
				return
			}
			if (this.form_data.information == '') {
				wx.showToast({
					title: '请输入取件信息',
					icon: 'error',
					duration: 2000
				})
				return
			}
			this.form_data.express_temp = [];
			for (var i = 0; i < this.express_box.length; i++) {
				if (this.express_box[i].number) {
					this.form_data.express_temp.push(this.express_box[i]);
				}
			}
			if (this.form_data.express_temp.length == 0) {
				wx.showToast({
					title: '请选择快递单件',
					icon: 'error',
					duration: 2000
				})
				return
			}
			this.form_data.express_temp = JSON.stringify(this.form_data.express_temp);
			console.log(this.form_data)
			this.goOrderIndex();
		},
		runerrandsUp() {
			uni.showLoading({
				title: '加载中'
			})
			//判断填写数据是否正确
			if (this.address_Takedelivery == '') {
				wx.showToast({
					title: '请输入取货地点',
					icon: 'error',
					duration: 2000
				})
				return
			}
			if (this.address_default == '') {
				wx.showToast({
					title: '请选择收货地点',
					icon: 'error',
					duration: 2000
				})
				return
			}
			if (this.form_data.hope_arrive == '') {
				wx.showToast({
					title: '请选择送达时间',
					icon: 'error',
					duration: 2000
				})
				return
			}
			if (this.form_data.information == '') {
				wx.showToast({
					title: '请输入帮助信息',
					icon: 'error',
					duration: 2000
				})
				return
			}
			// if (this.form_data.price == '') {
			// 	wx.showToast({
			// 		title: '请输入跑腿费',
			// 		icon: 'error',
			// 		duration: 2000
			// 	})
			// 	return
			// }
			if (parseFloat(this.form_data.price) < parseFloat(app.globalData.min_price)) {
				wx.showToast({
					title: '跑腿费最低为' + app.globalData.min_price + '元',
					icon: 'error',
					duration: 2000
				})
				return
			}
			if (this.form_data.price >= 10000) {
				wx.showToast({
					title: '跑腿费小于1万元',
					icon: 'error',
					duration: 2000
				})
				return
			}
			this.goOrderIndex();
		},
		goOrderIndex() {
			if (this.files.length) {
				//循环上传图片
				this.upImg(0, (res) => {
					uni.hideLoading();
					this.form_data.total_price = this.form_data.total_fee
					var path = '/pages/Component/Module/Campus/Program/Runerrands/detail/index'
					ikz.nav(path, 'ln', this.form_data);
				});
			} else {
				uni.hideLoading();
				this.form_data.total_price = this.form_data.total_fee
				var path = '/pages/Component/Module/Campus/Program/Runerrands/detail/index'
				ikz.nav(path, 'ln', this.form_data);
			}
		},
		//上传图片
		upImg(index, fn) {
			uni.showLoading({
				title: '加载中'
			})
			var that = this;
			var path = "/common/upload";
			var data = {}
			ikz.up(path, data, 'file', this.files[index], (res) => {
				var temp_result_data = JSON.parse(res.data);
				if (temp_result_data.code) {
					uni.hideLoading();
					that.form_data.annex_information_images.push(temp_result_data.data.url);
					if (that.files.length == (index + 1)) {
						fn();
					} else {
						index++
						that.upImg(index, fn)
					}
				} else {
					uni.showModal({
						title: '提示',
						content: temp_result_data.msg,
						showCancel: false,
						success: function (res) { }
					});
					uni.hideLoading();
				}
			})
		},
		//返回时间
		returnTime(e) {
			this.form_data.hope_arrive = e
		},
		check: function (e) {
			//正则表达试
			e.target.value = (e.target.value.match(/^\d*(\.?\d{0,2})/g)[0]) || ''
			//重新赋值给input
			this.$nextTick(() => {
				this.form_data.price = e.target.value
			})
		},
		// 
		checkPrice() {

			// // 4 租借服务运费
			// rent:0,
			// // 1 校园跑腿运费
			// campuserrands:0,
			// // 2 快递代取运费
			// type == 3 帮买
			// type == 1 帮送
			// expressdelivery:0,
			if (this.form_data.price) {
				this.form_data.price = parseFloat(this.form_data.price).toFixed(2);
			}

			if (this.form_data.type == 1) {
				this.form_data.total_fee = Number(this.rent)
				this.form_data.transportation_expenses = Number(this.rent).toFixed(2)
			} else if (this.form_data.type == 2) {
				this.form_data.total_fee = parseFloat(Number(this.form_data.price) + Number(this.expressdelivery))
					.toFixed(2);
				this.form_data.transportation_expenses = Number(this.expressdelivery).toFixed(2)
			} else if (this.form_data.type == 3) {
				console.log(this.rent)
				this.form_data.total_fee = Number(this.rent)
				this.form_data.transportation_expenses = Number(this.rent).toFixed(2)
			} else {
				this.form_data.total_fee = this.form_data.price;
			}

		},
		//我的地址
		goaddress(e) {
			uni.navigateTo({
				url: '/pages/Component/Module/Address/Program/myAddress/index?type=' + e
			})
		},
	}
};
</script>

<style lang="scss">
page {
	width: 100%;
	height: 100%;
	background: #F3F3F3;
}

.tips {
	margin: 0 30rpx;
	font-size: 26rpx;
	color: #FF5932;
}

.price {
	display: flex;
	align-items: center;

	input {
		width: 500rpx;
		padding-right: 15rpx;
		text-align: right;
	}
}

.ikz-top-bg {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	z-index: -1;
}

.ikz-school {
	width: 100%;
	height: 100%;
}

/* 输入 */
.ikz-form-input-box {
	box-sizing: border-box;
	padding: 30rpx;
	width: 95%;
	margin: 30rpx auto 0;
	display: flex;
	align-items: center;
	background: #fff;
	border-radius: 15rpx;
}

.ikz-form-input {
	width: 85%;
}

.ikz-form-input-img {
	width: 50rpx;
	height: 50rpx;
	margin-right: 10rpx;
}

.ikz-form-address {
	font-size: 28rpx;
}

.ikz-form-address-detail {
	color: #828282;
}

/* 输入 */

/* 其他 */
.ikz-tips {
	box-sizing: border-box;
	padding: 30rpx;
	width: 95%;
	margin: 30rpx auto 0;
	background: #fff;
	border-radius: 15rpx;
}

.ikz-tips-box {
	margin-top: 20rpx;
	width: 100%;
	height: 200rpx;
}

.ikz-tips-text {
	box-sizing: border-box;
	padding: 10rpx;
	width: 100%;
	height: 200rpx;
	border: 1px solid #CCCCCC;
	border-radius: 15rpx;
	font-size: 28rpx;

}

/* 其他 */
/* 底部 */
.ikz-bottom {
	position: fixed;
	bottom: 0px;
	left: 0px;
	display: flex;
	align-items: center;
	width: 100%;
	height: 150rpx;
	background: #F3F3F3;
	z-index: 99;
}

.ikz-bottom-box {
	width: 95%;
	height: 100rpx;
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #555555;
	border-bottom-left-radius: 60rpx;
	border-top-right-radius: 60rpx;
}

.ikz-bottom-price {
	margin-left: 50rpx;
	color: #fff;
	font-weight: 800;

}

.ikz-bottom-btn {
	box-sizing: border-box;
	padding: 0px 40rpx;
	height: 100rpx;
	line-height: 100rpx;
	color: #fff;
	border-bottom-left-radius: 60rpx;
	border-top-right-radius: 60rpx;
	background: linear-gradient(to right, #FBAB7E, #F8C66D);
}

/* 底部 */
.ikz-take {
	box-sizing: border-box;
	padding: 30rpx;
	width: 95%;
	margin: 30rpx auto 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #fff;
	border-radius: 15rpx;
}

.ikz-form-price-box {
	display: flex;
	align-items: center;
	box-sizing: border-box;
	padding: 30rpx;
	width: 95%;
	margin: 30rpx auto 0;
	background: #fff;
	border-radius: 15rpx;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.ikz-afters {
	position: relative;
}

.ikz-afters:after {
	content: " ";
	display: inline-block;
	height: 6px;
	width: 6px;
	border-width: 2px 2px 0 0;
	border-color: #888;
	border-style: solid;
	-webkit-transform: matrix(0.71, 0.71, -.71, 0.71, 0, 0);
	transform: matrix(0.71, 0.71, -.71, 0.71, 0, 0);
	top: -2px;
	position: absolute;
	top: 50%;
	margin-top: -4px;
	right: 20px;
}

/* 快递 */
.ikz-take {
	box-sizing: border-box;
	padding: 30rpx;
	width: 95%;
	margin: 30rpx auto 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #fff;
	border-radius: 15rpx;
}

.ikz-take-img {
	width: 80rpx;
	height: 80rpx;
}

.ikz-take-title {
	font-size: 30rpx;
}

.ikz-take-center {
	width: 50%;
	line-height: 50rpx;
}

.ikz-take-tips {
	color: #888888;
	font-size: 28rpx;
}

.ikz-take-option {
	width: 50rpx;
	height: 50rpx;
}

.ikz-take-right {
	width: 25%;
	display: flex;
	align-items: center;
}

.ikz-take-num {
	width: 40%;
	text-align: center;
}

/* 快递 */
</style>